
import request from '@/utils/request'
import { Comment } from './type'
import { BaseResponse, BasePageReq } from '../base'

export function comment(data: Comment): Promise<BaseResponse> {
  return request({ url: '/campus/comment/comment', method: 'post', data })
}

export function agree(id: number): Promise<BaseResponse> {
  return request({ url: `/campus/comment/agree/${id}`, method: 'post' })
}

export function pageQuery(params: BasePageReq): Promise<BaseResponse> {
  return request({ url: '/campus/comment/page', method: 'get', params })
}

export function pageByAncestor(params: BasePageReq): Promise<BaseResponse> {
  return request({ url: '/campus/comment/pageByAncestor', method: 'get', params })
}

export function del(id: number): Promise<BaseResponse> {
  return request({ url: `/campus/comment/delete/${id}`, method: 'delete' })
}

export function detail(id: number): Promise<BaseResponse> {
  return request({ url: `/campus/comment/getComment/${id}`, method: 'get' })
}